#ifndef __BUFFERSIMPLE_HPP__
#define __BUFFERSIMPLE_HPP__

namespace purewell
{

class PWBufferSimple : public PWBuffer
{
public:
	virtual ssize_t read(void* buf, size_t blen) const;
	virtual ssize_t readAndSkip(void* buf, size_t blen);
	virtual ssize_t skip(size_t blen);
	virtual ssize_t write(const void* buf, size_t blen);
	inline virtual size_t getCapacity(void) const {return (size_t)-1 -1;}
	inline virtual size_t getCurrentSize(void) const {return m_blen;}
	inline virtual int getType(void) const {return PWBUF_SIMPLE;}
	inline virtual bool getAutoSize(void) const {return true;}
	virtual void clear(void);
	inline virtual bool isEmpty(void) const {return m_blen == 0;}
	virtual ssize_t readLine(void* buf, size_t blen) const;
	virtual ssize_t readLineAndSkip(void* buf, size_t blen);

public:
	explicit PWBufferSimple();
	virtual ~PWBufferSimple();

private:
	bool _increase(size_t delta);
	bool _shrink(size_t delta);

private:
	char*	m_buf;
	size_t	m_blen;
};

};//namespace purewell

#endif//!__BUFFERSIMPLE_HPP__

